
/*************************************************************************

File:			replication_additional 
Date:			20 June 2025 

Description:	Replication of Appendices A-D

Note:			All numerical output, including tables, shown in the log-file
				CSV-file for t-tests stored on disk 
				All figures stored on disk as PDF
				
*************************************************************************/

/*

	Appendix A 

*/

preserve 

collapse (mean) rrpgov_th rrpgov_th_ext rrpgov ///
	w w2 austerity lag_austerity ///
	lnc c c_bil ln_c_bil (first) country, ///
	by(ccode year)

quietly xtset ccode year

* Table A.2: Proportion of RRP government observations per country in sample  

estpost tabstat rrpgov_th, by(country) stat(mean n)

* Figure A.1: Duration and frequency of RRP govts across OECD 

generate rrpth_year = year if rrpgov_th == 1

sort ccode year 
by ccode: gen first_rrp_year_temp = /// 
	cond(rrpgov_th == 1 & (rrpgov_th[_n-1]==0 | _n==1), year, .)

by ccode: replace first_rrp_year_temp = ///
	first_rrp_year_temp[_n-1] if missing(first_rrp_year_temp) & rrpth_year!=.

gsort ccode -year 

by ccode: gen last_rrp_year_temp = ///
	cond(rrpgov_th == 1 & (rrpgov_th[_n-1]==0 | _n==1), year, .)

by ccode: replace last_rrp_year_temp = ///
	last_rrp_year_temp[_n-1] if missing(last_rrp_year_temp) & rrpth_year!=.

sort ccode year 

encode country, gen(country_num) label(ctrlab)
	
twoway rcap first_rrp_year_temp last_rrp_year_temp ///
	country_num , horizontal /// 
	ylabel(1(1)37, valuelabel angle(0) /// 
	labsize(vsmall)) ytitle("") xtitle("") ///
	xtick(1990(5)2020)

gr export "FigureA1.pdf", as(pdf) replace 	

* Figure A.2: Duration and frequency of extended RRP govt coding across OECD 

gen rrpgov2 = (rrpgov>0 | rrpgov_th_ext == 1)

gen rrpgov2_year = year if rrpgov2 == 1

sort ccode year 
by ccode: gen first_rrp2_year_temp = /// 
	cond(rrpgov2 == 1 & (rrpgov2[_n-1]==0 | _n==1), year, .)
by ccode: replace first_rrp2_year_temp = ///
	first_rrp2_year_temp[_n-1] if missing(first_rrp2_year_temp) & rrpgov2_year!=.

gsort ccode -year 
by ccode: gen last_rrp2_year_temp = ///
	cond(rrpgov2 == 1 & (rrpgov2[_n-1]==0 | _n==1), year, .)
by ccode: replace last_rrp2_year_temp = ///
	last_rrp2_year_temp[_n-1] if missing(last_rrp2_year_temp) & rrpgov2_year!=.

twoway rcap first_rrp2_year_temp last_rrp2_year_temp country_num , horizontal /// 
	ylabel(1(1)37, valuelabel angle(0) labsize(vsmall)) ytitle("") xtitle("") ///
	xtick(1990(5)2020)

graph export "FigureA2.pdf", as(pdf) replace 	

restore 


* Figure A.3: Average amount of EF per aid sector 

preserve 
statsby, by(issuearea): ci means c 

twoway bar mean issuearea, base(0) barw(0.6) bfcolor(gray*0.4) ///
	|| rcap ub lb issuearea, ///
	xla(1(1)9,valuelabel alternate labsize(vsmall)) ///
	legend(off) xtitle("") ytick(0(50)300, grid) ///
	ytitle("Avg. EF in USD (millions)")

graph export "FigureA3.pdf", replace 
restore 


* Figure A.4: Average amount of bilateral per aid sector 

preserve 
set scheme plotplain 
statsby, by(issuearea): ci means c_bil 

twoway bar mean issuearea, base(0) barw(0.6) bfcolor(gray*0.4) /// 
	|| rcap ub lb issuearea, /// 
	xla(1(1)9, valuelabel alternate labsize(vsmall)) /// 
	legend(off) xtitle("") /// 
	ytitle("Avg. bilateral commitments in USD (millions)")
	
graph export "FigureA4.pdf", replace 
restore 	


* Table A.3: Commitments per aid sector as share of total commitments 

table issuearea, stat(percent c_bil) stat(percent c)


* Table A.4: T-test for difference in average EF commitments across sectors (on-screen output)
eststo clear 
levelsof issuearea if issuearea<10, local(issues) 
foreach issue of local issues {
	local labelname: label issue `issue'
	display ""
	display "T-test results for aid sector `issue': `labelname'"
	quietly eststo ttest_`issue' : estpost ttest c if issuearea == `issue', by(rrpgov_th) 
	esttab ttest_`issue', cells("mu_1(fmt(2) label(Non-RRP)) mu_2(fmt(2) label(RRP)) t(fmt(2)) count(fmt(0) label(N))") nonum noobs nomtitles varlabel(c "Earmarked funding") varwidth(30)
	display ""
	display "----------------------------------"
}
	 
	 	
* Table A.5: T-test for difference in average bilateral across sectors (on-screen output)
eststo clear 
levelsof issuearea if issuearea<10, local(issues) 
foreach issue of local issues {
	local labelname: label issue `issue'
	display ""
	display "T-test results for aid sector `issue': `labelname'"
	quietly eststo ttest_`issue' : estpost ttest c_bil if issuearea == `issue', by(rrpgov_th) 
	esttab ttest_`issue', cells("mu_1(fmt(2) label(Non-RRP)) mu_2(fmt(2) label(RRP)) t(fmt(2)) count(fmt(0) label(N))") nonum noobs nomtitles varlabel(c_bil "Bilateral aid") varwidth(30)
	display ""
	display "----------------------------------"
}


* Figure A.5: Distribution of (logged) EF over time 

graph box lnc, over(year, label(angle(45))) ///
	ylab(-10(2)10) noouts note("") ytitle("Log EF commitments") 
	
gr export "FigureA5.pdf", replace 


* Figure A.6: Average EF commitment over time 

graph bar c if year > 1989, ///
	over(year, label(labsize(small) angle(45))) ///
	ytitle("Average EF in USD (millions)") ///
	ylab(0(20)100) ytick(0(10)100, grid)

gr export "FigureA6.pdf", replace 	


* Table A.6: Descriptive statistics (for main models) 

tabstat c lnc ///
	c_bil ln_c_bil /// 
	rrpgov_th ///
	gdpcons_bil GDPpc govduration dac unemp parl oecdur austerity ///
	unr1-unr4 /// 
	is1-is9 , /// 
	format(%10.2g) columns(statistics) statistics(mean sd min max count)

		
/*

	Appendix B

*/

* Table B.7: descriptive statistics of dynamic IPTWs 

tabstat w if w!=., statistic(mean sd min max count) format(%9.2f)

* Figure B.7: Distribution of IPTWs over time 

graph box w, over(year, label(angle(45))) /// 
	ylab(0(1)10) ytitle("IPTW")
	
graph export "FigureB7.pdf", replace 	

	
* Table B.8: MSM with varying sets of fixed effects 


*** Ctr-sector specific FE 
quietly eststo fe_ctria_ef: /// 
	areg lnc i.year lag_austerity rrpgov_th [pw=w] ///
		if lnc!=. & ln_c_bil!=. & lag_austerity !=., robust absorb(ctr_ia)
				
quietly eststo fe_ctria_bi: ///
	areg ln_c_bil i.year  lag_austerity rrpgov_th [pw=w] ///
		if lnc!=. & ln_c_bil!=. & lag_austerity !=., robust absorb(ctr_ia)
 		
*** Only country FE 
quietly eststo fe_ctr_ef: ///
	areg lnc i.year lag_austerity rrpgov_th [pw=w] ///
		if lnc!=. & ln_c_bil!=. & lag_austerity !=., robust absorb(ccode)
	
quietly eststo fe_ctr_bi: ///
	areg ln_c_bil i.year lag_austerity rrpgov_th [pw=w] ///
		if lnc!=. & ln_c_bil!=. & lag_austerity !=., robust absorb(ccode)
				

esttab fe_ctria_ef fe_ctr_ef fe_ctria_bi fe_ctr_bi, ///
	keep(rrpgov_th _cons) ///
	mgroups("Earmarking" "Direct bilateral", span pattern(1 0 1 0)) /// 
	mtitles("FE: ctr-ia" "FE: ctr" "FE: ctr-ia" "FE: ctr" ) ///
	star(* 0.05) stats(r2_a F N, fmt(2 2 0) star(F)) ///
	b(2) se(2) note("Robust standard errors in parentheses.") ///
	coeflabe(rrpgov_th "RRP" _cons "Constant") varwidth(15) modelwidth(20)

* Figure B.8: Event plots (2 for EF and bilateral) 

quietly xtevent lnc lag_austerity [pw=w]  , /// 
	policyvar(rrpgov_th) panelvar(ctr_ia) time(year) ///
	window(-3 2) reghdfe vce(cluster ctr_ia) 
		
xteventplot, level(90) nosupt nonormlabel noprepval nopostpval ///
	ytitle("Effect of RRP on (log) EF commitments") xtitle("Event time")
	
graph save figureB8a.gph, replace 	

quietly xtevent ln_c_bil lag_austerity [pw=w]  , /// 
	policyvar(rrpgov_th) panelvar(ctr_ia) time(year) ///
	window(-3 2) reghdfe vce(cluster ctr_ia) 

xteventplot, nosupt nonormlabel noprepval nopostpval ///
	ytitle("Effect of RRP on (log) bilateral commitments") xtitle("Event time")
	
graph save figureB8b.gph, replace 
graph export "FigureB8.pdf", replace 	


* Table B.9: Linear MSMs with country-specific trends 

quietly eststo ae_ctrtrends_fe1: ///
	reghdfe lnc i.ccode#c.t lag_austerity rrpgov_th [pw=w], ///
		absorb(ccode  year) vce(cluster ctr_ia)

quietly eststo ae_ctrtrends_fe2: ///
	reghdfe lnc i.ccode#c.t lag_austerity rrpgov_th [pw=w],  ///
		absorb(issuearea  year) vce(cluster ctr_ia)
		

esttab ae_ctrtrends_fe1 ae_ctrtrends_fe2, ///
		replace  /// 
		b(3) se(2) /// 
		keep(rrpgov_th _cons) stats(r2_a F N, fmt(2 2 0) star(F)) ///
		coeflabels(rrpgov_th "RRP" _cons "Constant") ///
		note("Clustered robust standard errors in parentheses") ///
		nodepvar mtitles("FE: Country-year" "FE: Sector-year" ) star(* 0.05) ///
		modelwidth(25)



* Table B.10: MSMs with earmarked funding and stringency 

* Main model 	
quietly eststo main_msm: ///
	reghdfe lnc lag_austerity rrpgov_th [pw=w] , ///
		absorb(ccode issuearea year) vce(robust)
	
	
* Stringency 
quietly eststo string_1: ///
	reghdfe stringency lag_austerity rrpgov_th [pw=w] if lnc!=., ///
		absorb(ccode issuearea year) vce(robust)
	
quietly eststo string_2: ///
	reghdfe stringency lnc l.lnc lag_austerity rrpgov_th [pw=w], ///
		absorb(ccode issuearea year) vce(robust)

esttab main_msm string_*, ///
	keep(rrpgov_th _cons) star(* 0.05) ///
	coeflab(rrpgov_th "RRP" _cons "Constant") nodepvar ///
	mgroups("Earmarked funding" "Stringency", span pattern (1 1 0) ) b(2) se(2) ///
	note("Robust standard errors in parentheses.") /// 
	stats(r2_a F N, fmt(2 2 0) star(F)) modelwidth(20)



* Table B.11: Distribution of RRP govts across detailed UN regions 
*encode unregdet, gen(unregiondetail)

*tab unregiondetail

*tabstat rrpgov_th if c!=., by(unregiondetail) stat(mean sd count)
*tabstat rrpgov_th_ext if c!=., by(unregiondetail) stat(mean sd count)

quietly eststo rrp_unregdetail: ///
	estpost tabstat rrpgov_th if c!=., ///
	by(unregiondetail) stat(mean sd count)

quietly eststo rrp_ext_unregdetail: ///
	estpost tabstat rrpgov_th_ext if c!=., ///
	by(unregiondetail) stat(mean sd count)

esttab rrp_unregdetail rrp_ext_unregdetail, /// 
	replace  cells("mean(fmt(2)) sd(fmt(2)) count(fmt(0))") /// 
	mtitles("RRP" "RRP extended") nonum noobs varwidth(16)

* Table B.12: MSMs with no, sector, and region FEs 

global bls /// 
	bl_gdpcons_bil bl_govduration ///
	bl_GDPpc bl_unemp    
	
global lags /// 
	lag_gdpcons_bil lag_govduration /// 
	lag_GDPpc lag_dac /// 
	lag_unemp /// 
	lag_oecdur
	

* No fixed effects 	
quietly eststo msm_nofe: ///
	reg lnc $bls bl_austerity lag_austerity  /// 
	rrpgov_th[pw=w], cluster(ctr_ia)
	
* Issue area fixed effects 
quietly eststo msm_iafe: ///
	reg lnc i.issuearea $bls  bl_austerity lag_austerity /// 
	rrpgov_th [pw=w], cluster(ctr_ia)
	
quietly eststo msm_iafe_lags: ///
	reg lnc i.issuearea $bls $lags bl_austerity lag_austerity /// 
	rrpgov_th [pw=w], cluster(ctr_ia)
		
* Region fixed effects 
quietly eststo msm_regfe: ///
	reg lnc i.unregion $bls bl_austerity lag_austerity  /// 
	rrpgov_th [pw=w], cluster(ctr_ia)
	
	
* Region and issue area fixed effects 		
quietly eststo msm_reg_ia_fe: ///
	reg lnc i.unregion i.issuearea $bls bl_austerity lag_austerity  /// 
	rrpgov_th [pw=w], cluster(ctr_ia)
			
* Region and issue area fixed effects with lags 
quietly eststo msm_reg_ia_fe_lags: ///
	reg lnc i.unregion i.issuearea $bls $lags bl_austerity lag_austerity  /// 
	rrpgov_th [pw=w], cluster(ctr_ia)
		
 		
		
esttab msm_nofe msm_iafe msm_iafe_lags msm_regfe msm_reg_ia_fe msm_reg_ia_fe_lags,   /// 
		b(2) se(2) star(* 0.10 ** 0.05) keep(rrpgov_th _cons) ///
		coeflabel(rrpgov_th "RRP" _cons "Constant") ///
		stats(r2_a F N, fmt(2 2 0) star(F)) ///
		mgroups("Sector fixed effects" "Region fixed effects", span pattern(1 0 0 1 0 0)) ///
		mtitles("No FE" "Sector" "+TVCs" "Region" "+Sector" "+TVCs" ) ///
		note("Clustered robust SEs in parentheses.") modelwidth(15)

/*

	Appendix C 

*/

* Table C.13: MSM that drop one country at a time 

** Drop Turkey 	
quietly eststo ctrdrop_tur: ///
	areg lnc i.year i.issuearea lag_austerity rrpgov_th [pw=w] ///
		if ccode!=640 , absorb(ccode) robust 
		
** Drop CH 	
quietly eststo ctrdrop_ch: ///
	areg lnc i.year i.issuearea lag_austerity rrpgov_th [pw=w] ///
		if ccode!=225 , absorb(ccode) robust 
		
** Drop Italy  	
quietly eststo ctrdrop_ita: /// 
	areg lnc i.year i.issuearea lag_austerity rrpgov_th [pw=w] ///
		if ccode!=325 , absorb(ccode) robust 

** Drop Poland 	
quietly eststo ctrdrop_pol: /// 
	areg lnc i.year i.issuearea lag_austerity rrpgov_th [pw=w] ///
		if ccode!=290 , absorb(ccode) robust 
		
** Drop South Korea	
quietly eststo ctrdrop_rok: /// 
	areg lnc i.year i.issuearea lag_austerity rrpgov_th [pw=w] ///
		if ccode!=732 , absorb(ccode) robust 
		
** Drop USA 
quietly eststo ctrdrop_usa: ///
	areg lnc i.year i.issuearea lag_austerity rrpgov_th_ext [pw=w] ///
		if ccode!=2 , absorb(ccode) robust 
	
** Excluding all Eastern European countries  	
quietly eststo ctrdrop_eeur: /// 
	areg lnc i.year i.issuearea lag_austerity rrpgov_th [pw=w] ///
		if unregiondetail!=3 , absorb(ccode) robust 

** Excluding Eastern Asia
quietly eststo ctrdrop_easi: ///
	areg lnc i.year i.issuearea lag_austerity rrpgov_th [pw=w] /// 
		if unregiondetail!=2 , absorb(ccode) robust 
		
** Output table (on-screen)	
esttab ctrdrop_ch ctrdrop_ita ctrdrop_pol ctrdrop_rok /// 
		ctrdrop_tur ctrdrop_usa ctrdrop_eeur ctrdrop_easi, /// 
		b(2) se(2) rename(rrpgov_th_ext rrpgov_th) keep(rrpgov_th _cons)  ///
		mtitles("CH" "IT" "PL" "RK" "TR" "US" "E-Eur" "E-Asia" ) ///
		coeflab(rrpgov_th "RRP" _cons "Constant") star(* 0.05) ///
		stats(r2_a F N, fmt(2 2 0) star(F)) modelwidth(10) ///
		note("Robust SEs in parentheses.")
	

* Table C.14	
	
** Models for replicating Table C.14: MSM adding lagged DV and alternative IPTWs 
	
quietly eststo ldv_ef: ///
	areg lnc i.year i.issuearea lag_austerity l.lnc rrpgov_th [pw=w] ///
		if ln_c_bil!=., absorb(ccode) vce(cluster ctr_ia) 
		
quietly eststo ldv_bi: ///
	areg ln_c_bil i.year i.issuearea lag_austerity l.lnc rrpgov_th [pw=w] ///
		if lnc!=., absorb(ccode) vce(cluster ctr_ia) 
	
quietly eststo aw_ef: ///
	reghdfe lnc lag_austerity l(0).rrpgov_th [pw=w2] ///
		if ln_c_bil!=., vce(cluster ctr_ia) absorb(ccode issuearea year)
		
quietly eststo aw_bi: ///
	reghdfe ln_c_bil lag_austerity l(0).rrpgov_th [pw=w2] ///
		if lnc!=. , vce(cluster ctr_ia) absorb(ccode issuearea year)
	
* Output Table C.14 	
esttab ldv_ef ldv_bi aw_ef aw_bi  ///
		,  replace modelwidth(15) ///
		keep(rrpgov_th _cons) b(2) se(2) ///
		mgroups("Lag DV" "Weights 2", span pattern(1 0 1 0)) star(* 0.05) ///
		mtitles("EF" "BI" "EF" "BI") ///
		coeflab(rrpgov_th "RRP" _cons "Constant") ///
		stats(r2_a F N, fmt(2 2 0) star(F)) ///
		note("Cluster robust standard errors in parentheses." "EF = earmared funding" "BI = bilateral")


* Table C.15: Distribution of alternative IPTWs 

tabstat w2 if w2!=., stat(mean sd min max count) format(%9.2f)

* Code to prepare and produce Table C.16: MSM with varying RRP codings 

* Including US and Turkey (EF-BIL)
quietly eststo rrpcod_ustur_ef: ///
	areg lnc i.year i.issuearea  lag_austerity rrpgov_th_ext [pw=w] /// 
		if ln_c_bil!=., absorb(ccode) robust
	
quietly eststo rrpcod_ustur_bi: ///
	areg ln_c_bil i.year i.issuearea  lag_austerity rrpgov_th_ext [pw=w] /// 
		if lnc!=., absorb(ccode) robust
	
* Including US, excluding Turkey 
quietly eststo rrpcod_us_ef: ///
	areg lnc i.year i.issuearea  lag_austerity rrpgov_th_ext [pw=w] /// 
		if ln_c_bil!=. & ccode!=640, absorb(ccode) robust
	
quietly eststo rrpcod_us_bi: ///
	areg ln_c_bil i.year i.issuearea  lag_austerity rrpgov_th_ext [pw=w] /// 
		if lnc!=. & ccode!=640, absorb(ccode) robust
	
* Share of RRP months (EF-BIL)
quietly eststo rrpcod_sh_ef: ///
	areg lnc i.year i.issuearea  lag_austerity rrpgov [pw=w] ///
		if ln_c_bil!=., absorb(ccode) robust

quietly eststo rrpcod_sh_bi: ///
	areg ln_c_bil i.year i.issuearea  lag_austerity rrpgov [pw=w] /// 
		if lnc!=., absorb(ccode) robust

* Table C.16 
esttab rrpcod_ustur_ef rrpcod_ustur_bi ///
	rrpcod_us_ef rrpcod_us_bi ///
	rrpcod_sh_ef rrpcod_sh_bi ///
	, replace /// 
	b(2) se(2) stats(r2_a F N, fmt(2 2 0) star(F)) ///
	star(* 0.05) rename(rrpgov_th_ext rrpgov) keep(rrpgov _cons) ///
	coeflabel(rrpgov "RRP" _cons "Constant") /// 
	mgroups("Extended RRP" "Excluding Turkey" "Share RRP months", span pattern (1 0 1 0 1 0)) ///
	mtitles("EF" "BI" "EF" "BI" "EF" "BI") modelwidth(15) ///
	note("Robust SEs in parentheses." "EF = earmarked funding" "BI = bilateral")


* Table C.17: Negative binomial models with non-logged outcome vars 

*** Negative binomial models *** 
quietly eststo negbinEF: ///
	glm c i.year i.issuearea ///
		lag_austerity bl_gdpcons_bil bl_dacdur bl_oecdur ///
		bl_govduration bl_GDPpc bl_unemp bl_austerity ///
		rrpgov_th  [pw=w] if c_bil >=0, f(nbin) link(log) robust

quietly eststo negbinBI: /// 
	glm c_bil i.year i.issuearea ///
		lag_austerity bl_gdpcons_bil bl_dacdur bl_oecdur ///
		bl_govduration bl_GDPpc bl_unemp bl_austerity ///
		rrpgov_th  [pw=w] if c_bil>=0, f(nbin) link(log) robust 
	
*** Output Table C.17***: 
esttab 	negbinEF negbinBI,  se(2) ///
	keep(rrpgov_th _cons) /// 
	coeflabel(rrpgov_th "RRP" _cons "Constant") ///
	star(* 0.05) stat(ll aic N, fmt(2 2 0)) ///
	mtitle("EF" "BI") eqlabel(none) modelwidth(15)  ///
	note("Robust SEs in parentheses." "EF = earmarked funding" "BI = bilateral")


/*************************************************************************

End replication additional analyses 
				
*************************************************************************/
